package risk.export.record.poi.alibaba;


import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy;

import java.util.ArrayList;
import java.util.List;

/**
 * 读取本地excel
 * <a href="https://easyexcel.opensource.alibaba.com/">...</a>
 */
public class PoiTest2 {

    public static void main(String[] args) {

        List<DemoData> data = new ArrayList<>();
        for (int i = 0; i < 300000; i++) {
            DemoData demoData = new DemoData();
            demoData.setColumn1("这是数据" + i);
            demoData.setColumn2("这是数据" + i);
            demoData.setColumn3("这是数据" + i);
            demoData.setColumn4("这是数据" + i);
            demoData.setColumn5("这是数据" + i);
            demoData.setColumn6("这是数据" + i);
            demoData.setColumn7("这是数据" + i);
            demoData.setColumn8("这是数据" + i);
            demoData.setColumn9("这是数据" + i);
            demoData.setColumn10("这是数据" + i);
            data.add(demoData);
        }

        // 文件路径
        String fileName = "D:/output1.xlsx";

        EasyExcel.write(fileName, DemoData.class)//
                .registerWriteHandler(new SimpleColumnWidthStyleStrategy(50)) // 设置列宽
                .sheet("Sheet1")//
                .doWrite(data);

    }


}
